package controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import dao.pojo.Branch;
import dao.pojo.BranchExample;
import dao.pojo.BranchExample.Criteria;
import service.BranchService;

@Controller
public class PageHelperController {
	

	
	@Resource
	private BranchService branchService;
	
	@ResponseBody
	@RequestMapping(value="fenye")
	public PageInfo<Branch> fenYe(){
		//这个必须写在前面
		PageHelper.startPage(1, 10);
		
		BranchExample branchExample = new BranchExample();
		Criteria criteria = branchExample.createCriteria().andHotelIdEqualTo(10000);
		List<Branch> selectByExample = branchService.selectByExample(branchExample);
		PageInfo<Branch> pageInfo = new PageInfo<>(selectByExample);
		
		return pageInfo;
	}

}
